/*封装处理分页工具类*/

export function dealPageData(sourchData) {
  let pageData = {
    total:0,
    current:0,
    size:0,
    data:[]
  };
  pageData.data = sourchData.data.records;
  pageData.total = isString(sourchData.data.total) ? parseInt(sourchData.data.total) : sourchData.data.total;
  pageData.current = isString(sourchData.data.current) ? parseInt(sourchData.data.current) : sourchData.data.current;
  pageData.size = isString(sourchData.data.size) ? parseInt(sourchData.data.size) : sourchData.data.size;
  return pageData;
}

function isString(str){
  return ((str instanceof String) || (typeof str).toLowerCase() == 'string');
}
